package com.springboot.service.impl;

import com.springboot.mapper.AssistantMessageInformMapper;
import com.springboot.model.AssistantMessageInform;
import com.springboot.model.AssistantMessageInformKey;
import com.springboot.service.AssistantSetReadNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class AssistantSetReadNoticeServiceImpl implements AssistantSetReadNoticeService {
    @Autowired
    private AssistantMessageInformMapper assistantMessageInformMapper;

    @Override
    public AssistantMessageInform selectById(AssistantMessageInformKey assistantMessageInformKey){
        AssistantMessageInform assistantMessageInform=new AssistantMessageInform();
        try {
            assistantMessageInform=assistantMessageInformMapper.selectByPrimaryKey(assistantMessageInformKey);
        }
        catch (Exception e)
        {
            System.out.println("assistantMessageInformMapper错误");
        }
        return assistantMessageInform;
    }

    @Override
    public int updateRead(AssistantMessageInform assistantMessageInform){
        int a=0;
        try{
            a=assistantMessageInformMapper.updateByPrimaryKeySelective(assistantMessageInform);
        }
        catch (Exception e){
            System.out.println("assistantMessageInformMapper错误");
            e.printStackTrace();
        }
        return a;
    }

    @Override
    public ArrayList<AssistantMessageInform> selectAllNoReadByAssistantId(Integer assistantId){
        ArrayList<AssistantMessageInform> assistantMessageInforms=new ArrayList<>();
        try {
            assistantMessageInforms=assistantMessageInformMapper.selectAllNoReadByAssistantId(assistantId);
        }
        catch (Exception e){
            System.out.println("assistantMessageInformMapper错误");
            e.printStackTrace();
        }
        return assistantMessageInforms;
    }
}
